package main

import "fmt"

func main() {
	//	fmt.Println(demo2(1, 2))
	//arr:=[5]int {1,2,3,4,5}
	slice := []int{1, 2, 3, 4, 5}
	//fmt.Println(demoSum(arr...))
	fmt.Println(demoSum(slice...))
	fmt.Printf("%T \n", demoSum)
	fmt.Printf("%T \n", demoSliceSum)
}

func demo1() {
	fmt.Println("demo1")
}

func demo2(a, b int) int {
	return a + b
}

func demoSum(nums ...int) (num int) {
	for _, v := range nums {
		num += v
	}
	return num
}

func demoSliceSum(nums []int) (num int) {
	for _, v := range nums {
		num += v
	}
	return num
}
